home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Python 1.3.3 / Python 133 SRC / Mac / Python / macguesstabsize.c < prev    next >
C/C++ Source or Header  |  1995-01-22  |  475b  |  30 lines

  1. #include <Types.h>
  2. #include <Files.h>
  3. #include <OSUtils.h>
  4. #include <Resources.h>
  5.  
  6. #include <string.h>
  7.  
  8. /* Interface used by parsetok.c */
  9.  
  10. guesstabsize(path)
  11.     char *path;
  12. {
  13.     Str255 s;
  14.     int refnum;
  15.     Handle h;
  16.     int tabsize = 0;
  17.     s[0] = strlen(path);
  18.     memcpy(s+1, path, s[0]);
  19.     refnum = OpenResFile(s);
  20.     if (refnum == -1)
  21.         return 0;
  22.     UseResFile(refnum);
  23.     h = GetIndResource('ETAB', 1);
  24.     if (h != 0) {
  25.         tabsize = (*(short**)h)[1];
  26.     }
  27.     CloseResFile(refnum);
  28.     return tabsize;
  29. }
  30.